# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#   
#   cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
#   Major.create(:name => 'Daley', :city => cities.first)



#---REPORTS
report = Report.create!(:name => "test_report")

#---STRRATEGIES

strategy1 = Strategy.create!(:name => "Strategy 1: Maintain and expand cross-border cooperation", :order => 1, :short_name => "XB" )

strategy2 = Strategy.create!(:name => "Strategy 2: Improve human-animal sector interface and strengthen community surveillance", :order => 2, :short_name => "Animal-human and community surveillance" )

strategy3 = Strategy.create!(:name => "Strategy 3: Strengthen epidemiology capacity", :order => 3, :short_name => "Human Resources - epidemiology"  )

strategy4 = Strategy.create!(:name => "Strategy 4: Strengthen ICT capacity", :order => 4, :short_name => "ICT capacity"  )

strategy5 = Strategy.create!(:name => "Strategy 5: Strengthen laboratory capacity", :order => 5, :short_name => "Laboratory capacity"  )

strategy6 = Strategy.create!(:name => "Strategy 6: Strengthen risk communications", :order => 6, :short_name => "Risk communication"  )

strategy7 = Strategy.create!(:name => "Strategy 7: Conduct and apply policy research", :order => 7, :short_name => "Policy research"  )

#---GROUPINGS

grouping1 = Grouping.create!(:report => report, :strategy => strategy1 , :tab_name => "Strategy 1")

grouping2 = Grouping.create!(:report => report, :strategy => strategy2 , :tab_name => "Strategy 2")

grouping3 = Grouping.create!(:report => report, :strategy => strategy3 , :tab_name => "Strategy 3")

grouping4 = Grouping.create!(:report => report, :strategy => strategy4 , :tab_name => "Strategy 4")

grouping5 = Grouping.create!(:report => report, :strategy => strategy5 , :tab_name => "Strategy 5")

grouping6 = Grouping.create!(:report => report, :strategy => strategy6 , :tab_name => "Strategy 6")

grouping7 = Grouping.create!(:report => report, :strategy => strategy7 , :tab_name => "Strategy 7")

grouping8 = Grouping.create!(:report => report , :tab_name => "Overall Assessment", :header => "Since the last report... (describe briefly for relevant strategies for this reporting period)")


#-------------QUESTIONS 
#METHODS
def create_yes_no_question(grouping, args) code = args[:code] 
 textxb = args[:text_for_xb] 
 textcc = args[:text_for_cc] || args[:text_for_xb] 
 textsc = args[:text_for_sc] 
 
 option_yes = args[:text_option_yes] 
 option_no = args[:text_option_no]
 
 question = Question.create!(:grouping => grouping, :kind => "yes_no", :code => code) 
 
 QuestionByRole.create!(:question => question, :text => textxb, :kind => "xb", :columns_by_xb => "no", :first_column => "yes") unless textxb.nil?
 QuestionByRole.create!(:question => question, :text => textcc , :kind => "cc", :columns_by_xb => args[:columns_by_xb] || "no", :first_column => args[:first_column] || "yes") unless textcc.nil?
 QuestionByRole.create!(:question => question, :text => textsc , :kind => "sc", :columns_by_xb => args[:columns_by_xb] || "no", :first_column => "yes") unless textsc.nil?
 QuestionOption.create!(:question => question, :code => "YES", :text => option_yes) 
 QuestionOption.create!(:question => question, :code => "NO", :text => option_no)
 QuestionOption.create!(:question => question, :code => "YES_XB", :text => args[:text_option_yes_xb]) unless args[:text_option_yes_xb].nil? 
 QuestionOption.create!(:question => question, :code => "NO_XB", :text => args[:text_option_no_xb] ) unless args[:text_option_no_xb].nil?
 return question
end

def create_options_question(grouping, args)
  code = args[:code]
  textxb = args[:text_for_xb] 
  textcc = args[:text_for_cc] || args[:text_for_xb] 
  textsc = args[:text_for_sc]
  options = args[:options]
  
  question = Question.create!(:grouping => grouping, :kind => 'option', :code => code)
  
  QuestionByRole.create!(:question => question, :text => textxb, :kind => "xb", :columns_by_xb => "no", :first_column => "yes") unless textxb.nil?
  QuestionByRole.create!(:question => question, :text => textcc , :kind => "cc", :columns_by_xb => args[:columns_by_xb] || "no", :first_column => args[:first_column] || "yes") unless textcc.nil?
  QuestionByRole.create!(:question => question, :text => textsc , :kind => "sc", :columns_by_xb => args[:columns_by_xb] || "no", :first_column => args[:first_column] || "yes") unless textsc.nil?
  
  options.each do |option|
    QuestionOption.create!(:question => question, :code => option[:code], :text => option[:text])
  end
 
end

def create_excluding_options_question(grouping, args)
  code = args[:code]
  textxb = args[:text_for_xb] 
  textcc = args[:text_for_cc]
  textsc = args[:text_for_sc]
  options = args[:options]
  
  question = Question.create!(:grouping => grouping, :kind => 'excluding', :code => code)
  
  QuestionByRole.create!(:question => question, :text => textxb, :kind => "xb", :columns_by_xb => "no", :first_column => "yes") unless textxb.nil?
  QuestionByRole.create!(:question => question, :text => textcc , :kind => "cc", :columns_by_xb => args[:columns_by_xb] || "no", :first_column => args[:first_column] || "yes") unless textcc.nil?
  QuestionByRole.create!(:question => question, :text => textsc , :kind => "sc", :columns_by_xb => args[:columns_by_xb] || "no", :first_column => args[:first_column] || "yes") unless textsc.nil?
  
  options.each do |option|
    QuestionOption.create!(:question => question, :code => option[:code], :text => option[:text])
  end
end

#-------STRATEGY1

#QUESTION 1
create_yes_no_question(
grouping1, :code => '1-1', 
:text_for_xb => "I know the name and how to contact my XB counterpart (across border)", 
:text_for_cc => "XB manager knows counterpart (across border)", 
:text_for_sc => "Resource mapping completed",
:text_option_yes => "Name, contact info, date last verified", 
:text_option_no => "Why not?",
:repeat_columns => "yes",
:first_column => "auto")

#QUESTION 2
create_yes_no_question(
grouping1, 
:code => '1-2', 
:text_for_xb => "We have had at least one (>1) supervisory visit (past 6 months)", 
:text_for_cc => "At least one (>1) supervisory visit to XB site (past 6 months)", 
:text_for_sc => "Terms of Reference completed",
:text_option_yes => "Name and date", 
:text_option_no => "When was the last one?",
:first_column => "auto")

#QUESTION 3
create_yes_no_question(
grouping1, 
:code => '1-3', 
:text_for_xb => "We have participated in >1 meeting with another XB site (past 6 months)", 
:text_for_cc => "XB site participated in >1 meeting with another XB site (past 6 months)", 
:text_for_sc => "Site operational - programming underway",
:text_option_yes => "Date and location", 
:text_option_no => "When was your last meeting?",
:first_column => "auto")

#QUESTION 4
create_excluding_options_question(
grouping1, 
:code => '1-4', 
:text_for_xb => "Information shared with other XB Sites, MBDS, and/or non-MBDS past 12 months",
:options => [{:code => 'ALL', :text => 'All'},
             {:code => 'SOME', :text => 'Some'},
             {:code => 'NONE', :text => 'None'}
            ]
)

#-------STRATEGY2

#QUESTION 1a
create_yes_no_question(
grouping2, 
:code => '2-1a', 
:text_for_xb => "We have identified local counterparts for animal and human health",
:text_option_yes => "Name, contact info, date last verified", 
:text_option_no => "Why not?",
:first_column => "auto")

#QUESTION 1b
create_yes_no_question(
grouping2, 
:code => '2-1b', 
:text_for_cc => "Provincial animal and human health counterparts identified or confirmed", 
:text_option_yes => "Name, contact info, date last verified", 
:text_option_no => "Why not?")

#QUESTION 1c
create_yes_no_question(
grouping2, 
:code => '2-1c', 
:text_for_cc => "National animal and human health counterparts identified or confirmed", 
:text_option_yes => "Name, contact info, date last verified", 
:text_option_no => "Why not?")

#QUESTION 2
create_yes_no_question(
grouping2, 
:code => '2-2', 
:text_for_xb => "Mechanism for info sharing animal-human sector is in place and tested", 
:text_option_yes => "Describe", 
:text_option_no => "Why not?",
:first_column => "auto")

#QUESTION 3
create_yes_no_question(
grouping2, 
:code => '2-3', 
:text_for_xb => "We have identified (or know) priority zoonotic diseases for XB cooperation", 
:text_option_yes => "Diseases", 
:text_option_no => "Why not?",
:first_column => "auto")

#QUESTION 4
create_yes_no_question(
grouping2, 
:code => '2-4', 
:text_for_xb => "We have undertaken a TTX (past 12 months)", 
:text_option_yes => "Date, topic, participants", 
:text_option_no => "Why not?",
:first_column => "auto")

#QUESTION 5
create_yes_no_question(
grouping2, 
:code => '2-5', 
:text_for_xb => "We have established community-based surveillance at our site", 
:text_option_yes => "Describe", 
:text_option_no => "Why not?",
:first_column => "auto")

#QUESTION 6
create_yes_no_question(
grouping2, 
:code => '2-6', 
:text_for_cc => "Information shared with other XB Sites, MBDS, and/or non-MBDS past 12 months", 
:text_option_yes => "Describe", 
:text_option_no => "Why not?")

#QUESTION 7
create_yes_no_question(
grouping2, 
:code => '2-7',
:text_for_sc => "Joint outbreak investigation protocol developed",
:text_option_yes => "Describe", 
:text_option_no => "Why not?")

#QUESTION 8
create_yes_no_question(
grouping2, 
:code => '2-8',
:text_for_sc => "Guidelines for community-based surveillance developed, distributed ",
:text_option_yes => "Describe", 
:text_option_no => "Why not?")

#QUESTION 9
create_yes_no_question(
grouping2, 
:code => '2-9',
:text_for_sc => "Model for community-based surveillance tested ",
:text_option_yes => "Describe", 
:text_option_no => "Why not?")

#QUESTION 10
create_yes_no_question(
grouping2, 
:code => '2-10',
:text_for_sc => " Provincial TTX model developed, distributed ",
:text_option_yes => "Describe", 
:text_option_no => "Why not?")


#--------STRATEGY3

#QUESTION1
create_yes_no_question(
grouping3, 
:code => '3-1', 
:text_for_xb => "We have participated in short epidemiology course (past 12 months)", 
:text_option_yes => "#, name/s, date/s", 
:text_option_no => "Why not?",
:first_column => "auto")  

#QUESTION2
create_yes_no_question(
grouping3, 
:code => '3-2', 
:text_for_xb => "We have participated in short laboratory and Geographic Information System course (past 12 mos)", 
:text_option_yes => "#, name/s, date/s", 
:text_option_no => "Why not?",
:first_column => "auto")

#QUESTION3
create_yes_no_question(
grouping3, 
:code => '3-3', 
:text_for_xb => "We have participated in joint outbreak investigation (or TTX) (past 12 months)", 
:text_option_yes => "Date, outbreak, participants:", 
:text_option_no => "Why not?",
:first_column => "auto")

#QUESTION 4
create_yes_no_question(
grouping3, 
:code => '3-4', 
:text_for_cc => "Epidemiology coordinator has been identified, is in place", 
:text_option_yes => "#, name/s, date/s", 
:text_option_no => "Why not?")

#QUESTION 5
create_yes_no_question(
grouping3, 
:code => '3-5', 
:text_for_cc => "IHR epidemiology needs assessment has been completed", 
:text_option_yes => "#, name/s, date/s", 
:text_option_no => "Why not?")

#QUESTION 6
create_yes_no_question(
grouping3, 
:code => '3-6', 
:text_for_cc => "IHR workplan for epidemiology capacity building has been completed", 
:text_option_yes => "#, name/s, date/s", 
:text_option_no => "Why not?")

#QUESTION 7
create_yes_no_question(
grouping3, 
:code => '3-7', 
:text_for_cc => "Seed funding has been provided for epidemiology training program", 
:text_option_yes => "#, name/s, date/s", 
:text_option_no => "Why not?")

#QUESTION 8
create_yes_no_question(
grouping3, 
:code => '3-8', 
:text_for_cc => "At least 1 FETP alumnus has been trained as staff", 
:text_option_yes => "#, name/s, date/s", 
:text_option_no => "Why not?")

#QUESTION 9
create_yes_no_question(
grouping3, 
:code => '3-9', 
:text_for_cc => "Country has participated in long-term (FETP) training (#)", 
:text_option_yes => "#, name/s, date/s", 
:text_option_no => "Why not?")

#QUESTION 10
create_yes_no_question(
grouping3, 
:code => '3-10', 
:text_for_cc => "Progress review visit has been completed past 12 months", 
:text_option_yes => "#, name/s, date/s", 
:text_option_no => "Why not?")

#QUESTION 11
create_yes_no_question(
grouping3, 
:code => '3-11', 
:text_for_cc => "Information shared with other XB Sites, MBDS, and/or non-MBDS past 12 months", 
:text_option_yes => "#, name/s, date/s", 
:text_option_no => "Why not?")

#QUESTION 12
create_yes_no_question(
grouping3, 
:code => '3-12', 
:text_for_sc => "Develop XB outbreak investigation case study", 
:text_option_yes => "Describe", 
:text_option_no => "Why not?")


#--------STRATEGY4

#QUESTION 1
create_yes_no_question(
grouping4, 
:code => '4-1', 
:text_for_xb => "We have ICT hardware/software installed at our site, including updates", 
:text_option_yes => "Date & description", 
:text_option_no => "Why not?",
:first_column => "auto")  

#QUESTION 2
create_yes_no_question(
grouping4, 
:code => '4-2', 
:text_for_xb => "We have received ICT training at our site, including updates needed", 
:text_option_yes => "# trained, description", 
:text_option_no => "Why not?",
:first_column => "auto")  

#QUESTION 3
create_yes_no_question(
grouping4, 
:code => '4-3', 
:text_for_xb => "We have access to ICT support when needed", 
:text_option_yes => "Source of support", 
:text_option_no => "Why not?",
:first_column => "auto")  

#QUESTION 4
create_yes_no_question(
grouping4, 
:code => '4-4', 
:text_for_xb => "We routinely use ICT to communicate with province or national level", 
:text_option_yes => "Describe", 
:text_option_no => "Why not?",
:first_column => "auto")

#QUESTION 5
create_yes_no_question(
grouping4, 
:code => '4-5', 
:text_for_xb => "We use ICT for our routine surveillance", 
:text_option_yes => "Describe", 
:text_option_no => "Why not?",
:first_column => "auto")

#QUESTION 6
create_yes_no_question(
grouping4, 
:code => '4-6', 
:text_for_cc => "ICT is used for provincial and national surveillance", 
:text_option_yes => "Describe", 
:text_option_no => "Why not?")

#QUESTION 7
create_yes_no_question(
grouping4, 
:code => '4-7', 
:text_for_cc => "Back-up surveillance communications are in place", 
:text_option_yes => "Describe", 
:text_option_no => "Why not?")

#QUESTION 8
create_yes_no_question(
grouping4, 
:code => '4-8', 
:text_for_cc => "Communications with other MBDS countries tested/used past 12 months.", 
:text_option_yes => "Describe", 
:text_option_no => "Why not?")

#QUESTION 9
create_yes_no_question(
grouping4, 
:code => '4-9', 
:text_for_cc => "Information shared with other XB Sites, MBDS, and/or non-MBDS past 12 months", 
:text_option_yes => "Describe", 
:text_option_no => "Why not?")

#QUESTION 10
create_yes_no_question(
grouping4, 
:code => '4-10', 
:text_for_sc => "Regional policy for ICT procurement, licensing, application, sharing", 
:text_option_yes => "Describe", 
:text_option_no => "Why not?")


#--------STRATEGY 5

#QUESTION 1
create_yes_no_question(
grouping5, 
:code => '5-1', 
:text_for_xb => "We have timely access to laboratory testing for priority diseases", 
:text_option_yes => "Diseases with & without lab access", #TODO : enable multiple option
:text_option_no => "Why not?",
:first_column => "auto")

#QUESTION 2
create_yes_no_question(
grouping5, 
:code => '5-2', 
:text_for_xb => "We use available rapid diagnostic tests for priority diseases ", 
:text_option_yes => "Specify rapid tests used", 
:text_option_no => "Why not?",
:first_column => "auto")

#QUESTION 3
create_yes_no_question(
grouping5, 
:code => '5-3', 
:text_for_xb => "Our laboratory participates in proficiency testing (past 12 months)", 
:text_option_yes => "Date and results", 
:text_option_no => "Why not?",
:first_column => "auto")

#QUESTION 4
create_yes_no_question(
grouping5, 
:code => '5-4', 
:text_for_cc => "Lab and biosafety capacity needs have been assessed (IHR/APSED)", 
:text_option_yes => "Describe", 
:text_option_no => "Why not?",
:text_option_yes_xb => "Name, contact info, date last verified",
:text_option_no_xb => "Why not?",
:columns_by_xb => 'yes')

#QUESTION 5
create_yes_no_question(
grouping5, 
:code => '5-5', 
:text_for_cc => "Core diseases (for laboratory development purposes) have been identified", 
:text_option_yes => "Describe", 
:text_option_no => "Why not?")

#QUESTION 6
create_yes_no_question(
grouping5, 
:code => '5-6', 
:text_for_cc => "Lab resource mapping has been completed", 
:text_option_yes => "Describe", 
:text_option_no => "Why not?",
:text_option_yes_xb => "Name, contact info, date last verified",
:text_option_no_xb => "Why not?",
:columns_by_xb => 'yes')

#QUESTION 7
create_yes_no_question(
grouping5, 
:code => '5-7', 
:text_for_cc => "Lab equipment and reagents are in place, no stock-outs past 12 months", 
:text_option_yes => "Describe", 
:text_option_no => "Why not?",
:text_option_yes_xb => "Name, contact info, date last verified",
:text_option_no_xb => "Why not?",
:columns_by_xb => 'yes')

#QUESTION 8
create_yes_no_question(
grouping5, 
:code => '5-8', 
:text_for_cc => "Laboratory training has been completed (Country: number of people trained)", 
:text_option_yes => "Describe", 
:text_option_no => "Why not?",
:text_option_yes_xb => "Name, contact info, date last verified",
:text_option_no_xb => "Why not?",
:columns_by_xb => 'yes')

#QUESTION 9
create_yes_no_question(
grouping5, 
:code => '5-9', 
:text_for_cc => "Laboratory/ies above XB level participated in proficiency testing past 12 months", 
:text_option_yes => "Describe", 
:text_option_no => "Why not?")

#QUESTION 10
create_yes_no_question(
grouping5, 
:code => '5-10', 
:text_for_cc => "New laboratory technologiy/ies have been incorporated past 12 months.", 
:text_option_yes => "Describe", 
:text_option_no => "Why not?",
:text_option_yes_xb => "Name, contact info, date last verified",
:text_option_no_xb => "Why not?",
:columns_by_xb => 'yes')

#QUESTION 11
create_options_question(
grouping5,
:code => '5-11',
:text_for_cc => 'Standard testing protocols in place for (Country: laboratories above XB level)',
:options => [{:code => 'A', :text => 'Malaria'}, {:code => 'B', :text => 'Dengue' },
             {:code => 'C', :text => 'Cholera'}, {:code => 'D', :text => 'Influenza'},
             {:code => 'E', :text => 'Vaccine-preventable diseases'}, {:code => 'F', :text => 'HIV'},
             {:code => 'G', :text => 'TB'},
             {:code => 'OTHER', :text => 'Other priority disease/s'}],
:columns_by_xb => 'yes')

#QUESTION 12
create_yes_no_question(
grouping5, 
:code => '5-12', 
:text_for_cc => "Information shared with other XB Sites, MBDS, and/or non-MBDS past 12 months", 
:text_option_yes => "Describe", 
:text_option_no => "Why not?",
:text_option_yes_xb => "Name, contact info, date last verified",
:text_option_no_xb => "Why not?",
:columns_by_xb => 'yes')

#QUESTION 13
create_yes_no_question(
grouping5, 
:code => '5-13', 
:text_for_sc => "Regional protocol developed for specimen collection, identification, transportation, and reference testing", 
:text_option_yes => "Describe", 
:text_option_no => "Why not?")

#QUESTION 14
create_yes_no_question(
grouping5, 
:code => '5-14', 
:text_for_sc => "New diagnostic technology/-ies have been reviewed past 12 months. (and promising ones recommended for MBDS, if found)", 
:text_option_yes => "Describe", 
:text_option_no => "Why not?")


#-------STRATEGY 6

#QUESTION 1
create_yes_no_question(
grouping6, 
:code => '6-1', 
:text_for_xb => "We have received RC training", 
:text_option_yes => "#, name/s, date/s", 
:text_option_no => "Why not?",
:first_column => "auto")

#QUESTION 2
create_yes_no_question(
grouping6, 
:code => '6-2', 
:text_for_xb => "We have used (real situation) or tested (exercise) RC (past 12 months)", 
:text_option_yes => "Specify", 
:text_option_no => "Why not?",
:first_column => "auto")

#QUESTION 3
create_yes_no_question(
grouping6, 
:code => '6-3', 
:text_for_cc => "RC Point of Contact (spokesperson/s) has been identified or re-confirmed", 
:text_option_yes => "Specify", 
:text_option_no => "Why not?")

#QUESTION 4
create_yes_no_question(
grouping6, 
:code => '6-4', 
:text_for_cc => "Knowledge/attitudes/practices assessment has been completed",
:text_option_yes => "Specify", 
:text_option_no => "Why not?")

#QUESTION 5
create_yes_no_question(
grouping6, 
:code => '6-5',
:text_for_cc => "RC planning has been completed",
:text_option_yes => "Specify", 
:text_option_no => "Why not?")

#QUESTION 6
create_yes_no_question(
grouping6, 
:code => '6-6',
:text_for_cc => "RC training has been completed past 12 months.",
:text_option_yes => "Specify", 
:text_option_no => "Why not?")

#QUESTION 7
create_yes_no_question(
grouping6, 
:code => '6-7',
:text_for_cc => "Template communications messages/materials have been developed",
:text_option_yes => "Specify", 
:text_option_no => "Why not?")

#QUESTION 8
create_yes_no_question(
grouping6, 
:code => '6-8',
:text_for_cc => "Public health emergency hotline has been established",
:text_option_yes => "Specify", 
:text_option_no => "Why not?")

#QUESTION 9
create_yes_no_question(
grouping6, 
:code => '6-9',
:text_for_cc => "Satellite phone is available for emergency Public Health communications",
:text_option_yes => "Specify", 
:text_option_no => "Why not?")

#QUESTION 10
create_yes_no_question(
grouping6, 
:code => '6-10',
:text_for_cc => "Information shared with other XB Sites, MBDS, and/or non-MBDS past 12 months",
:text_option_yes => "Specify", 
:text_option_no => "Why not?")

#QUESTION 11
create_yes_no_question(
grouping6, 
:code => '6-11', 
:text_for_sc => "Risk communications framework has been completed", 
:text_option_yes => "Describe", 
:text_option_no => "Why not?")

#QUESTION 12
create_yes_no_question(
grouping6, 
:code => '6-12', 
:text_for_sc => "Risk communications curriculum has been developed", 
:text_option_yes => "Describe", 
:text_option_no => "Why not?")


#-----STRATEGY 7

#QUESTION 1
create_yes_no_question(
grouping7, 
:code => '7-1', 
:text_for_xb => "We have contributed ideas or participated in policy research (past 12 months)", 
:text_option_yes => "Specify", 
:text_option_no => "Why not?",
:first_column => "auto")

#QUESTION 2
create_yes_no_question(
grouping7, 
:code => '7-2', 
:text_for_cc => "Helped plan for policy research past 12 months.", 
:text_option_yes => "Specify", 
:text_option_no => "Why not?",
:text_option_yes_xb => "Name, contact info, date last verified",
:text_option_no_xb => "Why not?",
:columns_by_xb => 'yes')

#QUESTION 3
create_yes_no_question(
grouping7, 
:code => '7-3', 
:text_for_cc => "Helped analyze policy research past 12 months.", 
:text_option_yes => "Specify", 
:text_option_no => "Why not?",
:text_option_yes_xb => "Name, contact info, date last verified",
:text_option_no_xb => "Why not?",
:columns_by_xb => 'yes')

#QUESTION 4
create_yes_no_question(
grouping7, 
:code => '7-4', 
:text_for_cc => "Disseminated MBDS policy research findings past 12 months", 
:text_option_yes => "Specify", 
:text_option_no => "Why not?",
:text_option_yes_xb => "Name, contact info, date last verified",
:text_option_no_xb => "Why not?",
:columns_by_xb => 'yes')

#QUESTION 5
create_yes_no_question(
grouping7, 
:code => '7-5', 
:text_for_cc => "Applied MBDS policy research findings past 12 months.", 
:text_option_yes => "Specify", 
:text_option_no => "Why not?",
:text_option_yes_xb => "Name, contact info, date last verified",
:text_option_no_xb => "Why not?",
:columns_by_xb => 'yes')




#------Overall Assessment

#QUESTION1

 questionOA1 = Question.create!(:grouping => grouping8, :kind => "text") 
 
 QuestionByRole.create!(:question => questionOA1, :text => "What have been your main activities?", :kind => "xb")  
 
 #QuestionByRole.create!(:question => questionOA1, :text => "What have been your main activities?", :kind => "cc")

 #QuestionByRole.create!(:question => questionOA1, :text => "What have been your main activities?", :kind => "sc")

#QUESTION2

 questionOA2 = Question.create!(:grouping => grouping8, :kind => "text") 
 
 QuestionByRole.create!(:question => questionOA2, :text => "What have you learned and improved at your XB site, and how?", :kind => "xb") 
   
 #QuestionByRole.create!(:question => questionOA2, :text => "What have you learned and improved at your XB site, and how?", :kind => "cc") 

 #QuestionByRole.create!(:question => questionOA2, :text => "What have you learned and improved at your XB site, and how?", :kind => "sc") 

#QUESTION3

 questionOA3 = Question.create!(:grouping => grouping8, :kind => "text") 
 
 QuestionByRole.create!(:question => questionOA3, :text => "How have you shared (or do you plan to share) what you have learned with other XB sites or other MBDS stakeholders? ", :kind => "xb") 
 
 #QuestionByRole.create!(:question => questionOA3, :text => "How have you shared (or do you plan to share) what you have learned with other XB sites or other MBDS stakeholders? ", :kind => "cc")

 #QuestionByRole.create!(:question => questionOA3, :text => "How have you shared (or do you plan to share) what you have learned with other XB sites or other MBDS stakeholders? ", :kind => "sc")



#COUNTRIES

cambodia = Country.create! (:name => "Cambodia")
chinaguangxi = Country.create! (:name => "China Guangxi")
chinayunnan = Country.create! (:name => "China Yunnan")
laos = Country.create! (:name => "Lao PDR")
myanmar = Country.create! (:name => "Myanmar")
thailand = Country.create! (:name => "Thailand")
vietnam = Country.create! (:name => "Vietnam")
other = Country.create! (:name => "Other")

#-------------USERS

#METHODS

def createUser(type, number)
end

#---Admin
usAdm = User.create!(:name =>"System Administrator", :email =>"adminmail", :phone => "759 394 583", :address => "AdminAddress", :password => "admin",:password_confirmation =>"admin", :login =>"admin", :country => chinayunnan, :is_admin => true, :last_login=> Time.now ) if User.find_by_login("admin").nil?

#---cross borders

usXb1 = User.create!(:name =>"Dr. Xb 1", :email =>"uxb1mail",:phone => "555 999 533", :address => "XbAddress", :password => "uxb1",:password_confirmation =>"uxb1", :login =>"uxb1", :country => laos, :city =>"Savannakhet", :last_login=> Time.now ) if User.find_by_login("uxb1").nil?
usXb2 = User.create!(:name =>"Dr. Xb 2", :email =>"uxb2mail",:phone => "555 999 533", :address => "XbAddress", :password => "uxb2",:password_confirmation =>"uxb2", :login =>"uxb2", :country => vietnam, :city =>"Quang Tri", :last_login=> Time.now ) if User.find_by_login("uxb2").nil?
usXb3 = User.create!(:name =>"Dr. Xb 3", :email =>"uxb3mail",:phone => "555 999 533", :address => "XbAddress", :password => "uxb3",:password_confirmation =>"uxb3", :login =>"uxb3",  :country => thailand,:city => "Mukdaham", :last_login=> Time.now ) if User.find_by_login("uxb3").nil?
usXb4 = User.create!(:name =>"Dr. Xb 4", :email =>"uxb4mail",:phone => "555 999 533", :address => "XbAddress", :password => "uxb4",:password_confirmation =>"uxb4", :login =>"uxb4", :country => cambodia, :city => "Stung Trend",:last_login=> Time.now ) if User.find_by_login("uxb4").nil?
usXb5 = User.create!(:name =>"Dr. Xb 5", :email =>"uxb5mail",:phone => "555 999 533", :address => "XbAddress", :password => "uxb5",:password_confirmation =>"uxb5", :login =>"uxb5", :country => chinayunnan, :city => "Mengla",:last_login=> Time.now ) if User.find_by_login("uxb5").nil?
usXb6 = User.create!(:name =>"Dr. Xb 6", :email =>"uxb6mail",:phone => "555 999 533", :address => "XbAddress", :password => "uxb6",:password_confirmation =>"uxb6", :login =>"uxb6", :country => chinaguangxi, :city => "Ping Xiang",:last_login=> Time.now ) if User.find_by_login("uxb6").nil?
usXb7 = User.create!(:name =>"Dr. Xb 7", :email =>"uxb7mail",:phone => "555 999 533", :address => "XbAddress", :password => "uxb7",:password_confirmation =>"uxb7", :login =>"uxb7", :country => myanmar, :city => "Tachilake",:last_login=> Time.now ) if User.find_by_login("uxb7").nil?

#--- country coordinator
usCc1 = User.create!(:name =>"Dr. Cc Laos", :email =>"ucc1mail",:phone => "230 756 123", :address => "CcAddress", :password => "ucc1",:password_confirmation =>"ucc1", :login =>"ucc1",  :country => laos, :city => "Savannakhet", :last_login=> Time.now ) if User.find_by_login("ucc1").nil?
usCc2 = User.create!(:name =>"Dr. Cc Vietnam", :email =>"ucc2mail",:phone => "230 756 123", :address => "CcAddress", :password => "ucc2",:password_confirmation =>"ucc2", :login =>"ucc2", :country => vietnam, :city => "Quang Tri", :last_login=> Time.now ) if User.find_by_login("ucc2").nil?
usCc3 = User.create!(:name =>"Dr. Cc Thailand", :email =>"ucc3mail",:phone => "230 756 123", :address => "CcAddress", :password => "ucc3",:password_confirmation =>"ucc3", :login =>"ucc3", :country => thailand,:city =>"Mukdaham", :last_login=> Time.now ) if User.find_by_login("ucc3").nil?
usCc4 = User.create!(:name =>"Dr. Cc Cambodia", :email =>"ucc4mail",:phone => "230 756 123", :address => "CcAddress", :password => "ucc4",:password_confirmation =>"ucc4", :login =>"ucc4", :country => cambodia,:city =>"Takaeo", :last_login=> Time.now ) if User.find_by_login("ucc4").nil?
usCc5 = User.create!(:name =>"Dr. Cc China Y", :email =>"ucc5mail",:phone => "230 756 123", :address => "CcAddress", :password => "ucc5",:password_confirmation =>"ucc5", :login =>"ucc5", :country => chinayunnan,:city =>"Luchun", :last_login=> Time.now ) if User.find_by_login("ucc5").nil?
usCc6 = User.create!(:name =>"Dr. Cc China G", :email =>"ucc6mail",:phone => "230 756 123", :address => "CcAddress", :password => "ucc6",:password_confirmation =>"ucc6", :login =>"ucc6", :country => chinaguangxi,:city =>"Ping Xiang", :last_login=> Time.now ) if User.find_by_login("ucc6").nil?
usCc7 = User.create!(:name =>"Dr. Cc Myanmar", :email =>"ucc7mail",:phone => "230 756 123", :address => "CcAddress", :password => "ucc7",:password_confirmation =>"ucc7", :login =>"ucc7", :country => myanmar,:city =>"Tachilake", :last_login=> Time.now ) if User.find_by_login("ucc7").nil?

#--- lead strategy coordinator

usSc1 = User.create!(:name =>"Dr. Sc 1", :email =>"usc1mail",:phone => "363 754 896", :address => "ScAddress", :password => "usc1",:password_confirmation =>"usc1", :login =>"usc1", :country => laos, :city => "Savannakhet", :last_login=> Time.now ) if User.find_by_login("usc1").nil?
usSc2 = User.create!(:name =>"Dr. Sc 2", :email =>"usc2mail",:phone => "363 754 898", :address => "ScAddress", :password => "usc2",:password_confirmation =>"usc2", :login =>"usc2", :country => vietnam, :city => "Quang Tri", :last_login=> Time.now ) if User.find_by_login("usc2").nil?
usSc3 = User.create!(:name =>"Dr. Sc 2", :email =>"usc3mail",:phone => "363 754 898", :address => "ScAddress", :password => "usc3",:password_confirmation =>"usc3", :login =>"usc3", :country => thailand, :city => "Mukdaham", :last_login=> Time.now ) if User.find_by_login("usc3").nil?
usSc4 = User.create!(:name =>"Dr. Sc 2", :email =>"usc4mail",:phone => "363 754 898", :address => "ScAddress", :password => "usc4",:password_confirmation =>"usc4", :login =>"usc4", :country => cambodia, :city => "Takaeo", :last_login=> Time.now ) if User.find_by_login("usc4").nil?
usSc5 = User.create!(:name =>"Dr. Sc 2", :email =>"usc5mail",:phone => "363 754 898", :address => "ScAddress", :password => "usc5",:password_confirmation =>"usc5", :login =>"usc5", :country => chinayunnan, :city => "Luchun", :last_login=> Time.now ) if User.find_by_login("usc5").nil?
usSc6 = User.create!(:name =>"Dr. Sc 2", :email =>"usc6mail",:phone => "363 754 898", :address => "ScAddress", :password => "usc6",:password_confirmation =>"usc6", :login =>"usc6", :country => chinaguangxi, :city => "Ping Xiang", :last_login=> Time.now ) if User.find_by_login("usc6").nil?
usSc7 = User.create!(:name =>"Dr. Sc 2", :email =>"usc7mail",:phone => "363 754 898", :address => "ScAddress", :password => "usc7",:password_confirmation =>"usc7", :login =>"usc7", :country => myanmar, :city => "Tachilake", :last_login=> Time.now ) if User.find_by_login("usc7").nil?


#-------REPORT REQUESTS

repreq = ReportRequest.create!(:title => "Pending Report Request test", :description => "test" , :message =>"test", :report => report, :requestor => usAdm, :due_date => Time.now, :period_start =>Time.now, :period_end => Time.now )

#sumbmitedreprequest = ReportRequest.create!(:title => "Submited Report Test", :description => "submited report test" , :message =>"submited report test", :report => report, :requestor => usAdm, :due_date => Time.now, :period_start =>Time.now, :period_end => Time.now)

#sumbmitedreprequest2 = ReportRequest.create!(:title => "Submited Report Test 2", :description => "submited report test 2" , :message =>"submited report test 2", :report => report, :requestor => usAdm, :due_date => Time.now, :period_start =>Time.now, :period_end => Time.now)



# Cross Borders

xBorder = CrossBorder.create!(:code => "LAO - THAI", :number => 1)
xBorder2 = CrossBorder.create!(:code => "LAO - VIET", :number => 2)
xBorder3 = CrossBorder.create!(:code => "LAO - CAMB", :number => 3)
xBorder4 = CrossBorder.create!(:code => "LAO - CHIY", :number => 4)
xBorder5 = CrossBorder.create!(:code => "df", :number => 5)
xBorder6 = CrossBorder.create!(:code => "dfg", :number => 6)
xBorder7 = CrossBorder.create!(:code => "df)", :number => 7)
xBorder8 = CrossBorder.create!(:code => "df", :number => 8)
xBorder9 = CrossBorder.create!(:code => "df", :number => 9)
xBorder10 = CrossBorder.create!(:code => "ddgf", :number => 10)
xBorder11 = CrossBorder.create!(:code => "dfdg", :number => 11)
xBorder12 = CrossBorder.create!(:code => "dfgfd", :number => 12)
xBorder13 = CrossBorder.create!(:code => "fhnj", :number => 13)
xBorder14 = CrossBorder.create!(:code => "jggh", :number => 14)
xBorder15 = CrossBorder.create!(:code => "df", :number => 15)
xBorder16 = CrossBorder.create!(:code => "fgdg", :number => 16)
xBorder17 = CrossBorder.create!(:code => "jkg", :number => 17)
xBorder18 = CrossBorder.create!(:code => "gjgh", :number => 18)
xBorder19 = CrossBorder.create!(:code => "kgg", :number => 19)
xBorder20 = CrossBorder.create!(:code => "gjg)", :number => 20)
xBorder21 = CrossBorder.create!(:code => "gjg", :number => 21)
xBorder22 = CrossBorder.create!(:code => "fgh", :number => 22)
xBorder23 = CrossBorder.create!(:code => "sss)", :number => 23)

# Sites

siteA = Site.create!(:city => "Savannakhet", :cross_borders => [xBorder,xBorder2], :country => laos, :name => "Savannakhet (LAO)")
siteB = Site.create!(:city => "Mukdaham", :cross_borders => [xBorder], :country => thailand, :name => "Mukdaham (THAI)")

siteB2 = Site.create!(:city => "Quang Tri", :cross_borders => [xBorder2], :country => vietnam, :name => "Quang Tri (VIET)")

siteA3 = Site.create!(:city => "Champasak", :cross_borders => [xBorder3], :country => laos, :name => "Champasak (LAO)")
siteB3 = Site.create!(:city => "Stung Treng", :cross_borders => [xBorder3], :country => cambodia, :name => "Stung Treng (CAMB)")

siteA4 = Site.create!(:city => "Luang Namtha", :cross_borders => [xBorder4], :country => laos, :name => "Luang Namtha (LAO)")
siteB4 = Site.create!(:city => "Mengla", :cross_borders => [xBorder4], :country => chinayunnan, :name => "Mengla (CHI-Y)")

siteA5 = Site.create!(:city => "Bo Kaeo", :cross_borders => [xBorder5], :country => laos, :name => "Bo Kaeo (LAO)")
siteB5 = Site.create!(:city => "Chiang Rai", :cross_borders => [xBorder5], :country => thailand, :name => "Chiang Rai (THAI)")

siteA6 = Site.create!(:city => "Sakaeo", :cross_borders => [xBorder6], :country => thailand, :name => "Sakaeo (THAI)")
siteB6 = Site.create!(:city => "Banteay mean Chey", :cross_borders => [xBorder6], :country => cambodia, :name => "Banteay mean Chey (CAMB)")

siteA7 = Site.create!(:city => "Takaeo", :cross_borders => [xBorder7], :country => cambodia, :name => "Takaeo (CAMB)")
siteB7 = Site.create!(:city => "An Giang", :cross_borders => [xBorder7], :country => vietnam, :name => "An Giang (VIET)")

siteA8 = Site.create!(:city => "Kampot", :cross_borders => [xBorder8], :country => cambodia, :name => "Kampot (CAMB)")
siteB8 = Site.create!(:city => "Kien Giang", :cross_borders => [xBorder8], :country => vietnam, :name => "Kien Giang (VIET)")

siteA9 = Site.create!(:city => "Lai Chau", :cross_borders => [xBorder9], :country => vietnam, :name => "Lai Chau (VIET)")
siteB9 = Site.create!(:city => "Luchun", :cross_borders => [xBorder9], :country => chinayunnan, :name => "Luchun (CHI-Y)")

siteA10 = Site.create!(:city => "Chiang Rai", :cross_borders => [xBorder10], :country => thailand, :name => "Chiang Rai (THAI)")
siteB10 = Site.create!(:city => "Tachilake", :cross_borders => [xBorder10], :country => myanmar, :name => "Tachilake (MYAN)")

siteA11 = Site.create!(:city => "Champasak", :cross_borders => [xBorder11], :country => laos, :name => "Champasak (LAO)")
siteB11 = Site.create!(:city => "Ubon Ratchathani", :cross_borders => [xBorder11], :country => thailand, :name => "Ubon Ratchathani (THAI)")

siteA12 = Site.create!(:city => "Borikhamxay", :cross_borders => [xBorder12], :country => laos, :name => "Borikhamxay (LAO)")
siteB12 = Site.create!(:city => "Ha Tinh", :cross_borders => [xBorder12], :country => vietnam, :name => "Ha Tinh (VIET)")

siteA13 = Site.create!(:city => "Vientiane", :cross_borders => [xBorder13], :country => laos, :name => "Vientiane (LAO)")
siteB13 = Site.create!(:city => "Nongkhai", :cross_borders => [xBorder13], :country => thailand, :name => "Nongkhai (THAI)")

siteA14 = Site.create!(:city => "Mae Sot", :cross_borders => [xBorder14], :country => thailand, :name => "Mae Sot (THAI)")
siteB14 = Site.create!(:city => "Myawaddy", :cross_borders => [xBorder14], :country => myanmar, :name => "Myawaddy (MYAN)")

siteA15 = Site.create!(:city => "Chanthaburi", :cross_borders => [xBorder15], :country => thailand, :name => "Chanthaburi (THAI)")
siteB15 = Site.create!(:city => "Banteay mean Chey", :cross_borders => [xBorder15], :country => cambodia, :name => "Banteay mean Chey (CAMB)")

siteA16 = Site.create!(:city => "Lang Son", :cross_borders => [xBorder16], :country => vietnam, :name => "Lang Son (VIET)")
siteB16 = Site.create!(:city => "Ping Xiang", :cross_borders => [xBorder16], :country => chinaguangxi , :name => "Ping Xiang (CHI-G)")

siteA17 = Site.create!(:city => "Guang Ninh", :cross_borders => [xBorder17], :country => vietnam, :name => "Guang Ninh (VIET)")
siteB17 = Site.create!(:city => "Dong Xiang", :cross_borders => [xBorder17], :country => chinaguangxi, :name => "Dong Xiang (CHI-G)")

siteA18 = Site.create!(:city => "Svay Rieng", :cross_borders => [xBorder18], :country => cambodia, :name => "Svay Rieng (CAMB)")
siteB18 = Site.create!(:city => "Tay Ninh", :cross_borders => [xBorder18], :country => vietnam, :name => "Tay Ninh (VIET)")

siteA19 = Site.create!(:city => "Kampong Cham", :cross_borders => [xBorder19], :country => cambodia, :name => "Kampong Cham (CAMB)")
siteB19 = Site.create!(:city => "Tay Ninh", :cross_borders => [xBorder19], :country => vietnam, :name => "Tay Ninh (VIET)")

siteA20 = Site.create!(:city => "Konh Kong", :cross_borders => [xBorder20], :country => cambodia, :name => "Konh Kong (CAMB)")
siteB20 = Site.create!(:city => "Trat", :cross_borders => [xBorder20], :country => thailand, :name => "Trat (THAI)")

siteA21 = Site.create!(:city => "Kammouane", :cross_borders => [xBorder21], :country => laos, :name => "Kammouane (LAO)")
siteB21 = Site.create!(:city => "Nakorn Phanom", :cross_borders => [xBorder21], :country => thailand, :name => "Nakorn Phanom (THAI)")

siteA22 = Site.create!(:city => "Khammouane", :cross_borders => [xBorder22], :country => laos, :name => "Khammouane (LAO)")
siteB22 = Site.create!(:city => "Kuang Binh", :cross_borders => [xBorder22], :country => vietnam, :name => "Kuang Binh (VIET)")

siteA23 = Site.create!(:city => "Quang Ninh", :cross_borders => [xBorder23], :country => vietnam, :name => "Quang Ninh (VIET)")
siteB23 = Site.create!(:city => "Quangxi", :cross_borders => [xBorder23], :country => chinaguangxi, :name => "Quangxi (CHI-G)")



#--ROLES

#xb

roleXb1a = Role.create!(:users => [usXb1,usXb3], :coordinated => siteA)
roleXb1b = Role.create!(:users => [usXb3], :coordinated => siteB)

roleXb2b = Role.create!(:users => [usXb2], :coordinated => siteB2)

# usuario usXb1 es de savannakehet, que conteste tambien de champasak
roleXb3a = Role.create!(:users => [usXb1], :coordinated => siteA3)
roleXb3b = Role.create!(:users => [usXb4], :coordinated => siteB3)

# usuario usXb1 es de savannakehet, que conteste tambien de lung namtha
roleXb4a = Role.create!(:users => [usXb1], :coordinated => siteA4)
roleXb4b = Role.create!(:users => [usXb5], :coordinated => siteB4)

roleXb5a = Role.create!(:users => [usXb1], :coordinated => siteA5)
roleXb5b = Role.create!(:users => [usXb3], :coordinated => siteB5)

roleXb6a = Role.create!(:users => [usXb3], :coordinated => siteA6)
roleXb6b = Role.create!(:users => [usXb4], :coordinated => siteB6)

#cc

rolecc1 = Role.create!(:users => [usCc1,usSc2], :coordinated => laos)
rolecc2 = Role.create!(:users => [usCc2], :coordinated => vietnam)
rolecc3 = Role.create!(:users => [usCc3], :coordinated => thailand)
rolecc4 = Role.create!(:users => [usCc4], :coordinated => cambodia)
rolecc5 = Role.create!(:users => [usCc5], :coordinated => chinayunnan)
rolecc6 = Role.create!(:users => [usCc6], :coordinated => chinaguangxi)
rolecc7 = Role.create!(:users => [usCc7], :coordinated => myanmar)


#sc

roleSC1 = Role.create!(:users => [usSc1], :coordinated => strategy1)
roleSC2 = Role.create!(:users => [usSc2], :coordinated => strategy2)
roleSC3 = Role.create!(:users => [usSc3], :coordinated => strategy3)
roleSC4 = Role.create!(:users => [usSc4], :coordinated => strategy4)
roleSC5 = Role.create!(:users => [usSc5], :coordinated => strategy5)
roleSC6 = Role.create!(:users => [usSc6], :coordinated => strategy6)
roleSC7 = Role.create!(:users => [usSc7], :coordinated => strategy7)



#REPORT RESPONSES

Role.all.each do |r|
  ReportResponse.create!(:is_submitted =>false, :report_request => repreq, :owner_role => r)
  #ReportResponse.create!(:is_submitted =>true, :report_request => sumbmitedreprequest, :owner_role => r)
  #ReportResponse.create!(:is_submitted =>true, :report_request => sumbmitedreprequest2, :owner_role => r)
end

#------ANSWERS

def fill_answers(report_request)
  report_request.report_responses.find_all_by_is_submitted(true).each do |report_response| 
    report_response.questions.each_with_index  do |question, index|
      if question.is_yes_no
        fill_yes_no_question(report_response, question, index)
      elsif question.is_text
        fill_text_question(report_response, question)
      elsif question.is_excluding
        fill_excluding_question(report_response, question)
      elsif question.is_option
        fill_option_question(report_response, question)
      end
    end
  end
end  

def fill_yes_no_question(report_response, question, index) 
  question_option = index % 2 == 0 ? question.yes_clarification : question.no_clarification
  role = report_response.owner_role 
  question_by_role = question.for_role(role)
  
  if !question_by_role.first_column_auto?
    return
  end
  
  if role.is_strategy_coordinator
    if role.strategy.grouping.questions.include?(question)
      Answer.create!(:question => question, :option => question_option, :report_response => report_response, :value_text => "Default vaule for response 2")
    end
  else
    Answer.create!(:question => question, :option => question_option, :report_response => report_response, :value_text => "Default vaule for response 2")
  end
  
  # Questions for xb
  question_by_role = question.for_role(role)
  xb_roles = role.coordinated_xbs
  if question_by_role.columns_by_xb == 'yes' and not xb_roles.nil?
    xb_roles.each_with_index do |xb, index2|
      question_option_xb = index % 2 == 0 ? question.yes_xb_clarification : question.no_xb_clarification
      Answer.create!(:question => question, :option => question_option_xb, :report_response => report_response, :site => xb.site, :value_text => "Default vaule for response 2")
    end
  end
end

def fill_text_question(report_response, question)
  Answer.create!(:question => question, :report_response => report_response, :value_text => "Default vaule for response 2")
end

def fill_excluding_question(report_response, question)
  question_option = question.options.first
  Answer.create!(:question => question, :option => question_option, :report_response => report_response, :value_text => "Default vaule for response 2")
end

def fill_option_question(report_response, question)
  answer = Answer.create!(:question => question, :report_response => report_response, :value_text =>"Default not null")
  question.options.each_with_index do |option, index|
    state = index % 2 == 0
    AnswersQuestionOption.create! :answer => answer, :question_option => option, :state => state
  end
  
  # Questions for xb
  xb_roles = report_response.owner_role.coordinated_xbs
  xb_roles.each do |xb|
    answer_xb = Answer.create!(:question => question, :report_response => report_response, :site => xb.site, :value_text => "Default vaule for response 2")
    question.options.each_with_index do |option, index|
      state = index % 2 == 0
      AnswersQuestionOption.create! :answer => answer_xb, :question_option => option, :state => state
    end
  end
end

#fill_answers(sumbmitedreprequest)
#fill_answers(sumbmitedreprequest2)

#ReportResponse.all.each do |repres|
#  repres.update_completed
#end